﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Web.PageUI
{
    public class Search : Base
    {
        public Evan.Model.SysModel.PageModels PageList = new Evan.Model.SysModel.PageModels();
        public string SeoTitle = "";
        public string SeoKeywords = "";
        public string SeoDescription = "";

        public string Key = "";
        public int curPage = 1;
        public Search()
        {
            Key = Evan.Common.CommFun.GetQueryString("key");
            
            SeoTitle = SiteConfig.WebName;
            SeoKeywords = SiteConfig.WebKeyWords;
            SeoDescription = SiteConfig.WebDescription;

            int.TryParse(Evan.Common.CommFun.GetQueryString("page"), out curPage);

            string whereStr = "";
            if (!string.IsNullOrEmpty(Key))
            {
                whereStr = string.Format("(Title like '%{0}%'  or Intro like '%{0}%' or Content like '%{0}%')", Key);
            }


            PageList = new Evan.DataBase.DbOperat("v_Result").GetSearchPage(12, curPage, whereStr, " id desc");

        }
    }
}
